define([ "ojs/ojcore", "knockout", "jquery", "text!../template/scb-film-strip.html", "json!version", "ojs/ojfilmstrip", "ojs/ojpagingcontrol", "ojs/ojmodule" ], function (oj, ko, $, template, PromotionalOffersJSON) { "use strict"; var viewModel = function (Params) { var self = this; self.pagingModel = ko.observable(null); self.imgages = PromotionalOffersJSON.promotionaloffersimages; // self.imgages = [ // { name: './images/index/banner_01.jpg', url: 'https://www.scb.com.vn/vie/detail/personal_promotion_detail/thanh-toan-qr-uu-dai-ngap-tran' }, // { name: './images/index/banner_02.jpg', url: 'https://www.scb.com.vn/vie/detail/personal_promotion_detail/vay-uu-dai-mai-dong-hanh' } // ]; self.getItemInitialDisplay = function (index) { return index < 1 ? '' : 'none'; }; self.filmStripReady = function () { var filmStrip = document.getElementById('filmStrip'); var busyContext = oj.Context.getContext(filmStrip).getBusyContext(); busyContext.whenReady().then(function () { // Set the Paging Control pagingModel self.pagingModel(filmStrip.getPagingModel()); var pagingControl = document.getElementById('filmStripCardPagingControl'); // pagingControl.nextPage().then(function(e){console.log(e);}); }); }; self.loadTabInfo = function (obj) { if (obj.url !== '') { if (Params.baseModel.cordovaDevice()) { window.plugins.browsertab.isAvailable(function (isAvailable) { if (isAvailable) { window.plugins.browsertab.openUrl(obj.url); } else { window.open(obj.url, '_blank').focus(); } }); } else { window.open(obj.url, '_blank').focus(); } } }; // Params.dashboard.interval = setInterval(function(){ // var nextEl = $($('#filmStripCardPagingControl').find('.oj-selected')[0]).next(); // if(nextEl.length > 0){ // nextEl.trigger('click'); // } else { // $($('.oj-pagingcontrol-nav-pages-links').children()[0]).trigger('click'); // } // },5000); }; return { viewModel: viewModel, template: template }; });